<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>角色管理</title>
    <th:block th:include="statics/common/page/header"/>
    <!--  #parse("sys/header.html") -->
</head>
<body>
<div id="sysRole" v-cloak>
    <div v-show="showList">
        <Row class="search-panel-space">
            <div class="search-group">
                <i-col span="5">
                    <label class="search-label-20">角色名称:</label>
                    <i-input v-model="q.roleName" @on-enter="query" placeholder="角色名称" class="search-item-width-75"/>
                </i-col>
                <i-col span="5">
                    <label class="search-label-20">公司名称:</label>
                    <i-input v-model="q.companyName" @on-enter="query" placeholder="公司名称" class="search-item-width-75"/>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                <i-button type="info" @click="add" th:if="${@shiroAuthService.hasPermission('sys:role:save')}">
                	<i class="fa fa-plus"></i>&nbsp;新增</i-button>
                <i-button type="warning" @click="update" th:if="${@shiroAuthService.hasPermission('sys:role:update')}">
                	<i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                <i-button type="error" @click="del" th:if="${@shiroAuthService.hasPermission('sys:role:delete')}">
                	<i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                <i-button type="info" @click="selectCompanyCopy" th:if="${@shiroAuthService.hasPermission('sys:role:copy')}">
                	<i class="fa fa-plus"></i>&nbsp;复制</i-button>	
            </div>
        </Row>
        <table id="sysRoleGrid"></table>
    </div>

    <Card v-show="!showList">
        <p slot="title" style="height: 35px;">{{title}}
            <i-button type="warning" @click="reload" style="margin-right: 8px;float: right;"/>返回</i-button>
        </p>
        <i-form ref="formValidate" :model="role" :rules="ruleValidate" :label-width="150">
            <Form-item label="角色名称" prop="roleName" style="width:50%;">
                <i-input v-model="role.roleName" placeholder="角色名称"/>
            </Form-item>
            <Form-item label="所属公司" prop="companyId" style="width:50%;">
                <i-input type="text" v-model="role.companyName" icon="eye" readonly="readonly"
                         @on-click="selectCompany" placeholder="所属公司"/>
            </Form-item>
            <Form-item label="备注" prop="remark" style="width:50%;">
                <i-input type="textarea" v-model="role.remark" placeholder="备注"/>
            </Form-item>
            <Form-item label="项目" prop="remark" style="width:50%;">
            	<Checkbox-group v-model="role.domainIdList" @on-change="changeApp">
                    <Checkbox :label="app.id" v-for="app in appList" v-if="app.status==1">{{app.domainName}}</Checkbox>
                </Checkbox-group>
            </Form-item>
            <Form-item v-for="app in appList" v-if="app.selectStatus" :key="app.id" :label="app.domainName" style="width:50%;">
                <div style="overflow-y: auto;max-height: 200px">
                    <ul :id="'menuTree_'+app.id" class="ztree">{{app.domainName}}</ul>
                </div>
            </Form-item>
            <Form-item label="数据权限" style="width:50%;">
                <div style="overflow-y: auto;max-height: 250px">
                    <ul id="dataTree" class="ztree"></ul>
                </div>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>

<!-- 选择公司 -->
<div id="sysRoleLayer" style="display: none;padding:10px;">
    <ul id="sysRoleTree" class="ztree"></ul>
</div>

<script th:src="@{../statics/js/sys/role.js}"></script>
</body>
</html>